// 科技成果----软件著作权

import { CHECC_API_CMS } from '@/constants/proxy'
import request from '@/utils/request'
import { exportMethod } from '@/utils/utils'
import {ObjectType, ResponseDataPromise} from "../../../../typings/interfaces";
import * as proxy from "@/constants/proxy";
import {Params} from "@/views/science/technologyStrength/api/technologyStrength";




//导出
const getExport=(data: any,fileName)=> {
  const params = {
    method:'post',
    url: CHECC_API_CMS + '/kjsl/tresult/copyrights/export',
    data:data,
    fileName:fileName
  }
  return exportMethod(params)
}


// 数据字典

const getDictionary = (data: any = {}) => {
  return request.post(
    CHECC_API_CMS + `/dictItem/codelist`,
    data
  )
}


// 获取用户单位

const getUnit = (data: any = {}) => {
  return request.post(
    CHECC_API_CMS + `/kgptKjslTchieveSttrans/unitname`,
    data
  )
}

// 著作人

const getUser = (data: any = {}) => {
  return request.get(
    CHECC_API_CMS + `/user/getAll`,
    data
  )
}

// 项目
const getProject = (data: any = {}) => {
  return request.post(
    CHECC_API_CMS + `/xmzx/projectManagement/undertakeunit`,
    data
  )
}
//项目列表
export const projectManagementListPage = (data: Params): ResponseDataPromise<ObjectType> =>
    request({
      url: proxy.CONTRACT_MANAGEMENT + `/projectManagement/listPage?current=${data.current}&size=${data.size}`,
      method: 'post',
      data,
    })
// 科技成果科技奖励查询列表
export const techawardtListPage = (data: Params): ResponseDataPromise<ObjectType> => {
  return request({
    url: CHECC_API_CMS + '/kjsl/tresult/techaward/list',
    method: 'post',
    data
  })
}
// 科技成果专利查询列表
export const patentListPage = (params: Params): ResponseDataPromise<ObjectType> => {
  return request({
    url: CHECC_API_CMS + '/kjsl/tresult/patent/list',
    method: 'post',
    params
  })
}
// 科技成果软件著作查询列表
export const softwarecopyrightListPage = (params: Params): ResponseDataPromise<ObjectType> => {
  return request({
    url: CHECC_API_CMS + '/kjsl/tresult/copyrights/list',
    method: 'post',
    params
  })
}
// 技术标准查询列表
export const technicalnormsListPage = (params: Params): ResponseDataPromise<ObjectType> => {
  return request({
    url: CHECC_API_CMS + '/kjsl/tresult/contribute/standard/list',
    method: 'get',
    params
  })
}
// 技术工法查询列表
export const tetechnicalmethodsListPage = (params: Params): ResponseDataPromise<ObjectType> => {
  return request({
    url: CHECC_API_CMS + '/kjsl/tresult/contribute/techmethod/list',
    method: 'post',
    params
  })
}
// 学术论著查询列表
export const compositionListPage = (data: Params): ResponseDataPromise<ObjectType> => {
  return request({
    url: CHECC_API_CMS + '/kjsl/tresult/academicwork/list',
    method: 'post',
    data
  })
}
// 学术论文查询列表
export const thesisListPage = (data: Params): ResponseDataPromise<ObjectType> => {
  return request({
    url: CHECC_API_CMS + '/kjsl/tresult/academicpaper/list',
    method: 'post',
    data
  })
}
const getTechnology = (data: any = {}) => {
  return request.post(
    CHECC_API_CMS + `/xmzx/projectManagement/undertakeunit`,
    data
  )
}

// 详情

const getDetailById = (id: any = {}) => {
  return request.get(
    CHECC_API_CMS + `/kjsl/tresult/copyrights/getDetailById/${id}`,
  )
}


//新加/增加

const addForm = (data: any = {}) => {
  return request.post(
    CHECC_API_CMS + `/kjsl/tresult/copyrights/add`,
    data
  )
}

//新加/编辑

const editForm = (data: any = {}) => {
  return request.post(
    CHECC_API_CMS + `/kjsl/tresult/copyrights/update`,
    data
  )
}


// 查询列表


const getTable=(params: any)=> {
  return request({
    url:  CHECC_API_CMS + '/kjsl/tresult/copyrights/list',
    method: 'post',
    params
  })
}

// 解锁

const getUnlock = (id: any = {}) => {
  return request.get(
    CHECC_API_CMS + `/kjsl/tresult/copyrights/unlock/${id}`,
  )
}

// 锁定

const getLock = (id: any = {}) => {
  return request.get(
    CHECC_API_CMS + `/kjsl/tresult/copyrights/lock/${id}`,
  )
}

// 导出功能




// 确定当前流程

const getConfirm = (id: any = {}) => {
  return request.get(
    CHECC_API_CMS + `/kjsl/tresult/copyrights/confirm/${id}`,
  )
}

//删除(批量)
const getDelect = (id: any = {}) => {
  return request.delete(
    CHECC_API_CMS + `/kjsl/tresult/copyrights/delete/${id}`,
  )
}

export { addForm, editForm, getConfirm, getDelect, getDetailById, getDictionary, getExport, getLock, getProject, getTable, getTechnology, getUnit, getUnlock, getUser}

